Air Velocity 2 Click
Air Velocity 2 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : Stefan Filipovic
- Date : Feb 2025.
- Type : I2C type
Software Support
Example Description
This example demonstrates the use of Air Velocity 2 Click board by reading and displaying the output counts and air velocity in m/sec.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.AirVelocity2
Example Key Functions
- airvelocity2_cfg_setup This function initializes Click configuration structure to initial values.
void airvelocity2_cfg_setup(airvelocity2_cfg_t *cfg)
Air Velocity 2 configuration object setup function.
Air Velocity 2 Click configuration object.
Definition airvelocity2.h:118
- airvelocity2_init This function initializes all necessary pins and peripherals used for this Click board.
err_t airvelocity2_init(airvelocity2_t *ctx, airvelocity2_cfg_t *cfg)
Air Velocity 2 initialization function.
Air Velocity 2 Click context object.
Definition airvelocity2.h:104
- airvelocity2_read_output This function reads the raw output counts by using I2C serial interface.
err_t airvelocity2_read_output(airvelocity2_t *ctx, uint16_t *out_counts)
Air Velocity 2 read output function.
- airvelocity2_counts_to_mps This function converts raw output counts to velocity in m/sec (0-15).
float airvelocity2_counts_to_mps(uint16_t out_counts)
Air Velocity 2 counts to mps function.
Application Init
Initializes the driver and logger.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define AIRVELOCITY2_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition airvelocity2.h:92
void application_init(void)
Definition main.c:33
#define MIKROBUS_POSITION_AIRVELOCITY2
Definition main.c:27
Application Task
Reads the output counts and converts it to air velocity in m/sec. Both values will be displayed on the USB UART approximately every 125ms.
{
uint16_t out_counts = 0;
{
log_printf ( &logger, " Out counts: %u\r\n", out_counts );
Delay_ms ( 125 );
}
}
@ AIRVELOCITY2_OK
Definition airvelocity2.h:133
void application_task(void)
Definition main.c:63
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.